package com.qf.service;

import com.qf.dao.UserPojoMapper;
import com.qf.pojo.UserPojo;
import com.qf.pojo.UserPojoExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class UsersServiceImpl implements UsersService {
    @Autowired
    private UserPojoMapper mapper;
    public UserPojo login(String username, String password) {
        UserPojoExample example = new UserPojoExample();
        UserPojoExample.Criteria criteria = example.createCriteria();
        criteria.andUsernameEqualTo(username);
        criteria.andPasswordEqualTo(password);
        List<UserPojo> userPojos = mapper.selectByExample(example);
        if (userPojos!=null&&userPojos.size()>0){
            return userPojos.get(0);
        }
        return null;
    }
}
